<script>

export default {
    name: 'Son',
    props: ['fatherMsg', 'fatherHandle', 'sonToFather', 'sonToFatherEmit'],
    data() {
        return {
            msg: ''
        }
    },
    methods: {
        sonMethod() {
            console.log('sonMethod>>>>>>>>');
        }
    },
    mounted() {
        $bus.$on('send', (msg) => {
            this.msg = msg
        });
        this.fatherHandle(() => {
            alert('111111111')
        });   
    },
    methods: {
        tofather() {
            this.sonToFather('son-to-father-data')
        },
        tofatherEmit() {
            this.$emit('sonToFatherEmit', 'son-to-father-data-emit')
        }
    }
}

</script>
<template>

  <div>
      这是发过来的： {{msg}}<br />
      这是father传的 {{fatherMsg}}
      <button @click="tofather">tofather</button>
      <button @click="tofatherEmit">tofatherEmit</button>
  </div>
</template>